<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="generator" content="made with love by dartdoc 4.0.0">
  <meta name="description" content="sunmi_printer_plus API docs, for the Dart programming language.">
  <title>sunmi_printer_plus - Dart API docs</title>


  
  <link rel="preconnect" href="https://fonts.gstatic.com">
  <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  
  <link rel="stylesheet" href="static-assets/github.css?v1">
  <link rel="stylesheet" href="static-assets/styles.css?v1">
  <link rel="icon" href="static-assets/favicon.png?v1">

  
</head>


<body data-base-href=""
      data-using-base-href="false">

<div id="overlay-under-drawer"></div>

<header id="title">
  <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="https://github.com/brasizza/sunmi_printer/">sunmi_printer_plus package</a></li>
  </ol>
  <div class="self-name">sunmi_printer_plus</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<main>


  <div id="dartdoc-main-content" class="main-content">
      
<section class="desc markdown">
  <h1 id="sunmi_printer_plus">sunmi_printer_plus</h1>
<h1 id="this-is-a-fork-from-sunmi_printerhttpspubdevpackagessunmi_printer--but-i-implemented-a-lot-of-other-features-described-below">This is a fork from <a href="https://pub.dev/packages/sunmi_printer">sunmi_printer</a> , but i implemented a lot of other features described below</h1>
<h2 id="important">Important:</h2>
<p><strong>THIS PACKAGE WILL WORK ONLY IN ANDROID!</strong></p>
<p>Support Sunmi and Null Safety.
I build this flutter plugin based on this:
<a href="https://file.cdn.sunmi.com/SUNMIDOCS/%E5%95%86%E7%B1%B3%E5%86%85%E7%BD%AE%E6%89%93%E5%8D%B0%E6%9C%BA%E5%BC%80%E5%8F%91%E8%80%85%E6%96%87%E6%A1%A3EN-0224.pdf">Official Sunmi Inner Printer Doc</a>. But not all method from doc was included in this package, beacuse i don't have equipment. If you have and can help me, just contact me on github!</p>
<h2 id="installation">Installation</h2>
<pre class="language-bash"><code class="language-bash">flutter pub add sunmi_printer_plus
</code></pre>
<h2 id="what-this-package-do">What this package do</h2>
<ul>
<li><code>x</code> Write some text (with style or not!)</li>
<li><code>x</code> Change font size</li>
<li><code>x</code> Jump (n) lines</li>
<li><code>x</code> Draw a divisor line</li>
<li><code>x</code> Bold mode on/off</li>
<li><code>x</code> Print all types of Barcodes (see enum below)</li>
<li><code>x</code> Print Qrcodes with custom width and error-level</li>
<li><code>x</code> Print image from asset or from web (example show how to print both)</li>
<li><code>x</code> Print rows like recepit with custom width and alignment</li>
<li><code>x</code> Able to combine with some esc/pos code that you already have!</li>
<li><code>x</code> Cut paper - Dedicated method just to cut the line</li>
<li><code>x</code> Printer serial no - Get the serial number of the printer</li>
<li><code>x</code> Printer version - Get the printer's version</li>
<li><code>x</code> Printer paper size - Get the paper size ( 0: 80mm 1: 58mm)</li>
</ul>
<h2 id="if-you-have-an-ldc-printer-and-want-to-help-me-with-the-lcd-functions-just-contact-me">If you have an LDC printer and want to help me with the LCD functions just contact me</h2>
<ul>
<li><code>-</code> LCD functions</li>
</ul>
<h2 id="tested-devices">Tested Devices</h2>
<pre class="language-bash"><code class="language-bash">Sunmi V2 Pro 
</code></pre>
<h1 id="you-can-also-combine-this-package-with-the-package-esc_pos_utilshttpspubdevpackagesesc_pos_utils"><strong>You can also combine this package with the package <a href="https://pub.dev/packages/esc_pos_utils">esc_pos_utils</a></strong></h1>
<p><em>With this package you  <strong>can</strong>  create a custom escpos and than you don't need to use any other command.
This is good if you already have a code that another printers use, and u can reuse this code as well</em></p>
<p>#Just see the example folder!</p>
<p>Example screen</p><p align="left">
<img src="https://images2.imgbox.com/a1/f1/r1JCZvD2_o.png" width="350" title="hover text">
</p>
<pre class="language-dart"><code class="language-dart">// import packages
import 'package:sunmi_printer/sunmi_printer_plus.dart';


// all method from sunmi printer need to async await
await SunmiPrinter.bindingPrinter(); // must bind the printer first. for more exmaple.. pls refer to example tab.

</code></pre>
<h2 id="example-code-when-use-for-transaction-printing">Example code when use for transaction printing</h2>
<pre class="language-dart"><code class="language-dart">  await SunmiPrinter.startTransactionPrint(true);

  await SunmiPrinter.setAlignment(SunmiPrintAlign.RIGHT); // Right align
  await SunmiPrinter.printText('Align right');

  await SunmiPrinter.setAlignment(SunmiPrintAlign.LEFT);// Left align
  await SunmiPrinter.printText('Align left');

  await SunmiPrinter.setAlignment(SunmiPrintAlign.CENTER);// Center align
  await SunmiPrinter.printText('Align center');

  await SunmiPrinter.lineWrap(2); // Jump 2 lines

  await SunmiPrinter.setFontSize(SunmiFontSize.XL); // Set font to very large
  await SunmiPrinter.printText('Very Large font!');
  await SunmiPrinter.resetFontSize(); // Reset font to medium size

  await SunmiPrinter.printQRCode('https://github.com/brasizza/sunmi_printer'); // PRINT A QRCODE
  await SunmiPrinter.submitTransactionPrint(); // SUBMIT and cut paper
  await SunmiPrinter.exitTransactionPrint(true); // Close the transaction

</code></pre>
<h2 id="list-of-enum-printer-status">List of enum printer status</h2>
<pre class="language-dart"><code class="language-dart">enum PrinterStatus {
  ERROR,
  NORMAL, 
  ABNORMAL_COMMUNICATION, 
  OUT_OF_PAPER, 
  PREPARING,
  OVERHEATED,
  OPEN_THE_LID, 
  PAPER_CUTTER_ABNORMAL,
  PAPER_CUTTER_RECOVERED,
  NO_BLACK_MARK,
  NO_PRINTER_DETECTED,
  FAILED_TO_UPGRADE_FIRMWARE,
  EXCEPTION
}
</code></pre>
<h3 id="list-of-printer-verbose-status">List of printer verbose status</h3>
<pre class="language-dart"><code class="language-dart">{
    'ERROR': 'Something went wrong.', 
    'NORMAL': 'Works normally', 
    'ABNORMAL_COMMUNICATION': 'Abnormal communication',
    'OUT_OF_PAPER': 'Out of paper',
    'PREPARING': 'Preparing printer',
    'OVERHEATED': 'Overheated',
    'OPEN_THE_LID': 'Open the lid',
    'PAPER_CUTTER_ABNORMAL': 'The paper cutter is abnormal',
    'PAPER_CUTTER_RECOVERED': 'The paper cutter has been recovered',
    'NO_BLACK_MARK': 'No black mark had been detected',
    'NO_PRINTER_DETECTED': 'No printer had been detected',
    'FAILED_TO_UPGRADE_FIRMWARE': 'Failed to upgrade firmware',
    'EXCEPTION': 'Unknown Error code',
}
</code></pre>
<h3 id="list-of-enum-printer-mode">List of enum printer mode</h3>
<pre class="language-dart"><code class="language-dart">enum PrinterMode {
  NORMAL_MODE,
  BLACK_LABEL_MODE, 
  LABEL_MODE
}
</code></pre>
<h3 id="list-of-enum-alignments">List of enum Alignments</h3>
<pre class="language-dart"><code class="language-dart">enum SunmiPrintAlign {
  LEFT,
  CENTER,
  RIGHT,
}
</code></pre>
<h3 id="list-of-enum-qrcode-levels">List of enum Qrcode levels</h3>
<pre class="language-dart"><code class="language-dart">enum SunmiQrcodeLevel {
  LEVEL_L,
  LEVEL_M,
  LEVEL_Q,
  LEVEL_H,
}
</code></pre>
<h3 id="list-of-enum-barcode-types">List of enum Barcode types</h3>
<pre class="language-dart"><code class="language-dart">enum SunmiBarcodeType {
  UPCA,
  UPCE,
  JAN13,
  JAN8,
  CODE39,
  ITF,
  CODABAR,
  CODE93,
  CODE128,
}
</code></pre>
<h3 id="list-of-enum-text-position-in-barcode">List of enum Text position in barcode</h3>
<pre class="language-dart"><code class="language-dart">enum SunmiBarcodeTextPos {
  NO_TEXT,
  TEXT_ABOVE,
  TEXT_UNDER,
  BOTH,
}
</code></pre>
<h3 id="list-of-enum-font-sizes">List of enum Font sizes</h3>
<pre class="language-dart"><code class="language-dart">enum SunmiFontSize {
  XS,
  SM,
  MD,
  LG,
  XL,
}
</code></pre>
</section>


      <section class="summary">
          <h2>Libraries</h2>
        <dl>
          <dt id="column_maker">
  <span class="name"><a href="column_maker/column_maker-library.html">column_maker</a></span> 

</dt>
<dd> 
</dd>

          <dt id="enums">
  <span class="name"><a href="enums/enums-library.html">enums</a></span> 

</dt>
<dd> 
</dd>

          <dt id="sunmi_printer_plus">
  <span class="name"><a href="sunmi_printer_plus/sunmi_printer_plus-library.html">sunmi_printer_plus</a></span> 

</dt>
<dd> 
</dd>

          <dt id="sunmi_style">
  <span class="name"><a href="sunmi_style/sunmi_style-library.html">sunmi_style</a></span> 

</dt>
<dd> 
</dd>

        </dl>
      </section>

  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
  <form class="search-sidebar" role="search">
    <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
  <li><a href="https://github.com/brasizza/sunmi_printer/">sunmi_printer_plus package</a></li>
</ol>


    <h5 class="hidden-xs"><span class="package-name">sunmi_printer_plus</span> <span class="package-kind">package</span></h5>
    <ol>
      <li class="section-title">Libraries</li>
      <li><a href="column_maker/column_maker-library.html">column_maker</a></li>
      <li><a href="enums/enums-library.html">enums</a></li>
      <li><a href="sunmi_printer_plus/sunmi_printer_plus-library.html">sunmi_printer_plus</a></li>
      <li><a href="sunmi_style/sunmi_style-library.html">sunmi_style</a></li>
</ol>

  </div>

  <div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right">
  </div>

</main>

<footer>
  <span class="no-break">
    sunmi_printer_plus
      2.0.8
  </span>

  
</footer>



<script src="static-assets/highlight.pack.js?v1"></script>
<script src="static-assets/script.js?v1"></script>



</body>

</html>

